import QtQuick 2.0

//可以被点击的图像组件
Item {
    property alias text: label.text;
    property alias source: image.source;
    property bool framed: false;
    signal clicked;

    id: root;
    width: container.childrenRect.width + 16;
    height: container.childrenRect.height + 16;

    Rectangle {
        anchors.fill: parent;
        color: "white";
        visible: root.framed;
    }

    Column {
        id: container;
        anchors.centerIn: parent;
        Image {
            id: image;
        }
        Text {
            id: label;
            width: image.width;
            horizontalAlignment: Text.AlignHCenter;
            wrapMode: Text.WordWrap;
            color: "#000000";
        }
    }

    MouseArea {
        anchors.fill: parent;
        onClicked: {
            root.clicked();
        }
    }
}

